package com.jt.www.domain.enums.common;

/**
 * 投保中心人中关系
 * Created by shaoyn on 2020/09/03.
 */
public enum RelationshipEnum {
    SELF("00", "本人"),
    SPOUSE("01", "配偶"),
    PARENT("02", "父母"),
    CHILDREN("03", "子女"),
    BROTHERS_SISTERS("05", "兄弟姐妹"),
    EMPLOYER("06", "雇主"),
    EMPLOYEE("07", "雇员"),
    GRANDPARENTS("08", "祖父母、外祖父母"),
    GRANDCHILDREN("09", "祖孙、外祖孙"),
    GUARDIAN("10", "监护人"),
    WARD("11", "被监护人"),
    FRIEND("12", "朋友"),
    UNKNOWN("98", "未知"),
    OTHER("99", "其他"),
    ;

    /**
     * 关系码
     */
    private String relCode;
    /**
     * 关系描述
     */
    private String desc;

    RelationshipEnum(String relCode, String desc) {
        this.relCode = relCode;
        this.desc = desc;
    }

    public static String getCodeByDesc(String desc) {
        for (RelationshipEnum relationshipEnum : RelationshipEnum.values()) {
            if (relationshipEnum.desc.equals(desc)) {
                return relationshipEnum.relCode;
            }
        }

        return RelationshipEnum.UNKNOWN.relCode;
    }


    public String getRelCode() {
        return relCode;
    }

    public String getDesc() {
        return desc;
    }
}
